package com.stars.home.vmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.hwangjr.rxbus.RxBus
import com.stars.home.config.ConfigRx
import com.stars.home.model.TrMsgList
import com.stars.home.utils.net.NetEngine
import com.trailer.base.base.BRepository
import com.trailer.base.base.BViewModel
import kotlinx.coroutines.launch

class MsgDetailsVModel(application: Application) : BViewModel<BRepository>(application) {


    var index:Int?=null
    var bean=MutableLiveData<TrMsgList>()


    fun toSetRead(id:String?){
        viewModelScope.launch {
            var it=repository().lreq { NetEngine.service.messageRead(id,"0") }
            if(it.ok()){
                //刷新列表
                RxBus.get().post(ConfigRx.MSG_RED, ""+index)


            }
        }

    }


}



